/**
 * Copyright(c): 2017 com.mjduan All rights reserved.
 * 项目名：WebMvc
 * 注意：未经作者允许，不得外传
 */
package com.mjduan.project.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author mjduan@yahoo.com mjduan 2018-04-29 08:33
 * @version 1.0
 * @since 1.0
 */
public final class LOG {
    private static final Logger Logger= LoggerFactory.getLogger(LOG.class);

    private LOG() {
    }

    public static void info(final Object arg) {
        if (arg == null) {
            return;
        }
        if (arg instanceof Throwable) {
            info(null, Throwable.class.cast(arg));
        } else {
            info(arg.toString(), null, null);
        }
    }

    public static void info(final String infoMessage, final Object... args) {
        Logger.info(infoMessage, args);
    }

    public static void info(final String infoMessage, final Throwable throwable) {
        Logger.info(infoMessage, throwable);
    }

    public static void warn(final String warnMessage) {
        warn(warnMessage, null, null);
    }

    public static void warn(final String infoMessage, final Object... args) {
        Logger.warn(infoMessage, args);
    }

    public static void warn(final String infoMessage, final Throwable throwable) {
        Logger.warn(infoMessage, throwable);
    }

    public static void error(final String errorMessage) {
        error(errorMessage, null, null);
    }

    public static void error(final String errorMessage, final Object... args) {
        Logger.error(errorMessage, args);
    }

    public static void error(final String errorMessage, final Throwable throwable) {
        Logger.error(errorMessage, throwable);
    }

    public static void error(final Throwable throwable) {
        error(null, throwable);
    }
}
